﻿ 

using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.Reflection;
using zkdao.Application;
using zkdao.Domain;
using zkdao.Enum;
using sharp_net;
using log4net;

namespace zkdao.Wcf {
	public class ImageService : IImageService {
		private readonly IImageService imgService = IocLocator.Instance.GetImple<IImageService>();
				public ImageData Get(Int32 ID) {
			try {
				return imgService.Get(ID);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public ImageData GetByPath(String path) {
			try {
				return imgService.GetByPath(path);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public ImageData GetByHost(eImageHostType hostType, String hostId) {
			try {
				return imgService.GetByHost(hostType, hostId);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public ImageData Creat(ImageData dataObject, String userKey) {
			try {
				return imgService.Creat(dataObject, userKey);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
				public void Update(ImageData dataObject) {
			try {
				 imgService.Update(dataObject);
			}
			catch(Exception ex) {
				ILog Log = LogManager.GetLogger("AppService", MethodBase.GetCurrentMethod().DeclaringType);
				Log.Error(ex);
				throw new FaultException<FaultData>(FaultData.CreateFromException(ex), FaultData.CreateFaultReason(ex));
			}
		}
			}
}